﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LFM_Playlist_Builder
{
    //Form created with help from the instructions at http://www.eggheadcafe.com/community/aspnet/2/10065083/open-webpage-from-winforms.aspx

    public partial class authForm : Form
    {
        bool mHooked;
        String endUrl = "http://www.last.fm/api/grantaccess";
        String theUrl = "http://www.last.fm/api/auth/?api_key=" + Global.LASTKEY + "&token=";
        String token;

        public authForm(String iToken)
        {
            token = iToken;
            InitializeComponent();
            webAuth.Navigate(theUrl + iToken);
            webAuth.DocumentCompleted += webAuth_DocumentCompleted;
        }

        void webAuth_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (webAuth.Url.ToString() == endUrl)
            {
                this.Close();
            }
        }

        void btnCont_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
